<template>
  <div id="app">
    <back-btn></back-btn>
    <br />
    <input type="text" v-model="ipt" />
  </div>
</template>

<script lang="ts">
import { defineComponent, onActivated, onDeactivated, onMounted, ref } from "vue";
import { useRouter } from "vue-router";

export default defineComponent({
  setup() {
    const ipt = ref("");

    const router = useRouter();

    onMounted(() => {
        console.warn("只有第一次进入缓存组件才触发onMounted")
    })

    onActivated(() => {
      console.log("进入缓存组件onActivated");
    });

    onDeactivated(() => {
      console.log("离开缓存组件onDeactivated");
    });

    return { ipt, router };
  },
});
</script>

<style scoped></style>
